<!--************************************************************************************************-->
<!-- < mainPage.php >                                                                               -->
<!-- Copyright (c) 2012-2013 San Yat-sun University School of Software                              -->
<!-- Founder : Xiaofen Huang                                                                        -->
<!-- Stu : 10389169                                                                                 -->
<!-- Modifier: Yijing Chen                                                                          -->
<!-- Stu : 10389144                                                                                 -->
<!-- Modifier: Xiaoxin Mo                                                                           -->
<!-- Stu : 10389159                                                                                 -->
<!-- Date: 2012-12-23                                                                               -->
<!-- Destription : 通过url传递书名           -->
<!--                                                                                        -->
<!-- Version : 3.1
<!-- Last updated: 2013-01-06 13:00 by Xiaoxin Mo -->                                                                          
<!--************************************************************************************************-->

<!DOCTYPE html>
<?php
	include_once("header.php");
	//include_once("bottom.php");
	include_once("../manager/BookManager.php");
	include_once("../manager/DescriptionManager.php");
	include_once("../manager/CommentManager.php");
	include_once("../db/Book.php");
	//$book_name = $_SESSION['currentBook'];
	$book_name = $_REQUEST['book_name'];
	$book_value = BookManager::getInstance()->getValueByBookname($book_name);
	$description = DescriptionManager::getInstance()->getValueByBookname($book_name);
	$comment_values = CommentManager::getInstance()->getValueByBookname($book_name);
	
?>
<html lang="zh-hk">
<head>
	<title>Tiny bOOk</title>
	
	<meta http-equiv="Content-Type" content="text/html charset=UTF-8">
	<meta name="contentType" value="text/html  charset=GBK">
	<meta name="description" content="在这里你可以看到最新发布的书籍，和好友共享对某本书的评论和笔记">
	<meta http-equiv="imagetoolbar" content="no">
	<meta name="viewport" content="width=1036">
	
	<link rel="stylesheet" type="text/css" href="../css/bookPage.css">
</head>

<body>
	<div id="main">
		<!--left -->
		<div id="left">
			<div id="book_content">
				<div id="book_title">
					<h2><?=$book_name?><h2>
				</div>
				<!--cover of the book-->
				<div id="book_img">
					<p><img src="..\images\books\<?=$book_name?>.jpg" alt="No founded"/></p>
				</div>
				<div id="book_list">
					<ul id="book_inerlist">
						<li id="book_name">
							<span>书名：<?=$book_name?></span>
						</li>
						<li id="actor">
							<span>作者：<?=$book_value['AuthorName']?></span>
						</li>
						<li id="actor">
							<span>作者简介：<?=$book_value['AuthorBrief']?></span>
						</li>
						<?php
							if ($book_value['Translator'] != null)
							{
							?>
								<li id="actor">
									<span>译者：<?=$book_value['Translator']?></span>
								</li>
							<?php	
							}
						?>
						<li id="press">
							<span>出版社：<?=$book_value['Publishing']?></span>
						</li>
						<li id="page">
							<span>页数：<?=$book_value['Pages']?></span>
						</li>
						<li id="value">
							<span>定价：<?=$book_value['Price']?>元</span>
						</li>
						<li id="tag">
							<span>标签:</span>
							
								<a href="booklist.php?description=<?=$description['Content']?>"><?=$description['Content']?></a>
						</li>
					</ul>

				</div>
			</div>
			<div id="introduce">
				<span>内容简介……</span>
				<pre><?=$book_value['ContentBrief']?></pre>
				
			</div>
			<!--added by xiaojing,10389144-->
			<?php
			if (isset($_SESSION['currentUser']))
			{
			?>
				<div id="addnote">
					<a href="addNoteForBook.php?book_name=<?=$book_name?>">我要写笔记</a>
				</div>
				<!--added by xiaojing,10389144-->
				<div id="addcomment">
					<a href="addCommentForBook.php?book_name=<?=$book_name?>">我要评论</a>
				</div>
			<?php
			}
			?>
		
			<div id="hasedcomment">
				<span>评论……</span>
				<?php
				while ($comment_value = mysql_fetch_array($comment_values))
				{
				?>
					<div id="each">
						<!--<img src="../images/hxf.jpg" />-->
						<p>评论人：<a href="userPage.php?user_name=<?=$comment_value['Username']?>"><?=$comment_value['Username']?></a></p>
						<pre><?=$comment_value['Content']?></pre>
					</div>
				<?php
				}
				?>
			</div>
		</div>	
	</div><!--end of main-->
</body>